/*
 * Copyright (C) 2008  Wang Hoi <fearee@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
*/
#ifndef SETTINGS_H
#define SETTINGS_H

#include <QtCore>
#include <QtNetwork>
#define DEFAULT_MAX_MEM_BUFFER_TIME 60
#define DEFAULT_MAX_FILE_BUFFER_TIME 600
#define DEFAULT_CHUNK_SIZE 2000000
#define DEFAULT_LISTEN_ADDRESS (QHostAddress::Any)
#define DEFAULT_LISTEN_PORT 10000
class Settings: public QObject
{
    Q_OBJECT
public:
    Settings(const QString &filePath);
    ~Settings();
    quint64 maxMemBufferTime() const;
    quint64 maxFileBufferTime() const;
    size_t chunkSize() const;
    QHostAddress listenAddress() const;
    quint16 listenPort() const;
    QMap<QString, QString> sources() const;
private:
    QSettings settings;
    QMap<QString, QString> srcs;
    quint64 maxMemBufferTime_;
    quint64 maxFileBufferTime_;
    size_t chunkSize_;
    QHostAddress listenAddress_;
    quint16 listenPort_;
};
#endif
